package itsm.isperp.report.paser;

import java.util.List;

import org.springframework.data.jdbc.support.DatabaseType;

/**
 * 
 * 
 * 
 * @author lizx
 * @date 2015-12-3
 * @since 1.0
 * 
 */
public class QueryLineLegend {

	private String start;
	private String end;

	private String dateFormat;

	private List<String> values;

	public String getDateFormatQuery(String column) {

		if (itsm.isperp.framework.data.dialect.DialectFactory.getDatabaseType() == DatabaseType.ORACLE) {
			return "TO_CHAR(" + column + ",'" + this.getDateFormat() + "')";
		} else {

			String format = this.getDateFormat();

			format = format.replace("yyyy", "%Y").replace("mm", "%m")
					.replace("dd", "%d").replace("iw", "%u");

			return "DATE_FORMAT(" + column + ",'" + format + "')";

		}

	}

	public String getStart() {
		return start;
	}

	public void setStart(String start) {
		this.start = start;
	}

	public String getEnd() {
		return end;
	}

	public void setEnd(String end) {
		this.end = end;
	}

	public String getDateFormat() {
		return dateFormat;
	}

	public void setDateFormat(String dateFormat) {
		this.dateFormat = dateFormat;
	}

	public List<String> getValues() {
		return values;
	}

	public void setValues(List<String> values) {
		this.values = values;
	}

}
